/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package runebound.ui.combate;

import runebound.modelo.heores.Heroe;
import runebound.modelo.monstruos.Monstruo;

/**
 *
 * @author Miguel (alakat@gmail.com)
 */
public class RBCombateFrame extends javax.swing.JFrame {

    
    private Heroe heroe;
    private Monstruo monstruo;
    
    
    /**
     * Creates new form RBCombateFrame
     */
    public RBCombateFrame() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        rBFinCombatePanel1 = new runebound.ui.combate.RBFinCombatePanel();
        rBTestAntesCombatePanel1 = new runebound.ui.combate.RBAntesCombateTestPanel();
        infomacionCombate = new javax.swing.JLabel();
        rBCombatePanel1 = new runebound.ui.combate.RBCombatePanel();
        tituloHeroe = new javax.swing.JLabel();
        tituloMonstruo = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        descripcionoMonstruo = new javax.swing.JLabel();
        menteMonstruo = new javax.swing.JLabel();
        fisicoMonstruo = new javax.swing.JLabel();
        magiaMonstruo = new javax.swing.JLabel();
        menteHeroe = new javax.swing.JLabel();
        fisicoHeroe = new javax.swing.JLabel();
        magiaHeroe = new javax.swing.JLabel();
        heroeDescripcion = new javax.swing.JLabel();
        heridaHeroe = new javax.swing.JLabel();
        heridaMonstruo = new javax.swing.JLabel();
        fatigaHeroe = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        heridasFlotantesHeroe = new javax.swing.JLabel();
        agotamientoFlotanteHeroe = new javax.swing.JLabel();
        heridasFlotanteMonstruo = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        infomacionCombate.setText("Texto de ayuda en el juego");
        getContentPane().add(infomacionCombate, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 371, 400, 26));
        getContentPane().add(rBCombatePanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 215, -1, -1));

        tituloHeroe.setText("Título heroes");
        getContentPane().add(tituloHeroe, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 8, -1, -1));

        tituloMonstruo.setText("Título del monstruo");
        getContentPane().add(tituloMonstruo, new org.netbeans.lib.awtextra.AbsoluteConstraints(281, 8, -1, -1));

        jLabel4.setText("Dis:");
        getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 110, -1, -1));

        jLabel5.setText("Fis:");
        getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 132, -1, -1));

        jLabel6.setText("Mag:");
        getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 154, -1, -1));

        jLabel7.setText("Mag:");
        getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(239, 154, -1, -1));

        jLabel8.setText("Fis:");
        getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(239, 132, -1, -1));

        jLabel9.setText("Dis:");
        getContentPane().add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(239, 110, -1, -1));

        descripcionoMonstruo.setText("jLabel10");
        getContentPane().add(descripcionoMonstruo, new org.netbeans.lib.awtextra.AbsoluteConstraints(206, 57, 200, 47));

        menteMonstruo.setText("12 / 2");
        getContentPane().add(menteMonstruo, new org.netbeans.lib.awtextra.AbsoluteConstraints(276, 110, -1, -1));

        fisicoMonstruo.setText("12 / 2");
        getContentPane().add(fisicoMonstruo, new org.netbeans.lib.awtextra.AbsoluteConstraints(279, 132, -1, -1));

        magiaMonstruo.setText("12 / 2");
        getContentPane().add(magiaMonstruo, new org.netbeans.lib.awtextra.AbsoluteConstraints(281, 154, -1, -1));

        menteHeroe.setText("12 / 2");
        getContentPane().add(menteHeroe, new org.netbeans.lib.awtextra.AbsoluteConstraints(48, 110, -1, -1));

        fisicoHeroe.setText("12 / 2");
        getContentPane().add(fisicoHeroe, new org.netbeans.lib.awtextra.AbsoluteConstraints(51, 132, -1, -1));

        magiaHeroe.setText("12 / 2");
        getContentPane().add(magiaHeroe, new org.netbeans.lib.awtextra.AbsoluteConstraints(53, 154, -1, -1));

        heroeDescripcion.setText("jLabel2");
        getContentPane().add(heroeDescripcion, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 57, 188, 47));

        heridaHeroe.setBackground(new java.awt.Color(255, 0, 51));
        heridaHeroe.setForeground(new java.awt.Color(255, 255, 255));
        heridaHeroe.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        heridaHeroe.setText("6");
        heridaHeroe.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        heridaHeroe.setOpaque(true);
        getContentPane().add(heridaHeroe, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 6, 24, -1));

        heridaMonstruo.setBackground(new java.awt.Color(255, 0, 51));
        heridaMonstruo.setForeground(new java.awt.Color(255, 255, 255));
        heridaMonstruo.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        heridaMonstruo.setText("6");
        heridaMonstruo.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        heridaMonstruo.setOpaque(true);
        getContentPane().add(heridaMonstruo, new org.netbeans.lib.awtextra.AbsoluteConstraints(251, 6, 24, -1));

        fatigaHeroe.setBackground(new java.awt.Color(255, 204, 51));
        fatigaHeroe.setForeground(new java.awt.Color(255, 255, 255));
        fatigaHeroe.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        fatigaHeroe.setText("6");
        fatigaHeroe.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        fatigaHeroe.setOpaque(true);
        getContentPane().add(fatigaHeroe, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 6, 24, -1));
        getContentPane().add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 199, 400, 10));

        heridasFlotantesHeroe.setFont(new java.awt.Font("Lucida Grande", 3, 10)); // NOI18N
        heridasFlotantesHeroe.setForeground(new java.awt.Color(204, 0, 0));
        heridasFlotantesHeroe.setText("-2");
        getContentPane().add(heridasFlotantesHeroe, new org.netbeans.lib.awtextra.AbsoluteConstraints(129, 32, 15, -1));

        agotamientoFlotanteHeroe.setFont(new java.awt.Font("Lucida Grande", 3, 10)); // NOI18N
        agotamientoFlotanteHeroe.setForeground(new java.awt.Color(255, 153, 0));
        agotamientoFlotanteHeroe.setText("-2");
        getContentPane().add(agotamientoFlotanteHeroe, new org.netbeans.lib.awtextra.AbsoluteConstraints(159, 32, 15, -1));

        heridasFlotanteMonstruo.setFont(new java.awt.Font("Lucida Grande", 3, 10)); // NOI18N
        heridasFlotanteMonstruo.setForeground(new java.awt.Color(204, 0, 0));
        heridasFlotanteMonstruo.setText("-2");
        getContentPane().add(heridasFlotanteMonstruo, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 32, 15, -1));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(RBCombateFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(RBCombateFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(RBCombateFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(RBCombateFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new RBCombateFrame().setVisible(true);
            }
        });
    }
    
    public void setCombate(Monstruo m, Heroe h){
        this.rBCombatePanel1.setCombate(m, h);
        this.heroe=h;
        this.monstruo=m;
        updateDatosCombate();
        
    }

    /**
     * 
     * @param h
     * @param m 
     */
    public void updateDatosCombate() {
        Heroe h = this.heroe;
        Monstruo m = this.monstruo;
        this.tituloHeroe.setText(h.getNombre());
        this.tituloMonstruo.setText(m.getTitulo());
        this.descripcionoMonstruo.setText(m.getDescripcion());
        this.menteHeroe.setText(" "+h.getValorCombateDistancia()+" / "+h.getFuerzaMente());
        this.fisicoHeroe.setText(" "+h.getValorCombateFisico()+" / "+h.getFuerzaFisico());
        this.magiaHeroe.setText(" "+h.getValorCombateMagia()+" / "+h.getFuerzaMagia());
        this.heridaHeroe.setText(""+h.getVidaActual());
        this.fatigaHeroe.setText(""+h.getFatigaActual());
        this.heridasFlotantesHeroe.setText("");
        this.agotamientoFlotanteHeroe.setText("");
        
        this.menteMonstruo.setText(" "+m.getValorMente()+" / "+m.getFuerzaMente());
        this.fisicoMonstruo.setText(" "+m.getValorFisico()+" / "+m.getFuerzaFisico());
        this.magiaMonstruo.setText(" "+m.getValorMagia()+" / "+m.getFuerzaMagia());
        this.heridaMonstruo.setText("" +m.getVida());
        this.heridasFlotanteMonstruo.setText("");
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel agotamientoFlotanteHeroe;
    private javax.swing.JLabel descripcionoMonstruo;
    private javax.swing.JLabel fatigaHeroe;
    private javax.swing.JLabel fisicoHeroe;
    private javax.swing.JLabel fisicoMonstruo;
    private javax.swing.JLabel heridaHeroe;
    private javax.swing.JLabel heridaMonstruo;
    private javax.swing.JLabel heridasFlotanteMonstruo;
    private javax.swing.JLabel heridasFlotantesHeroe;
    private javax.swing.JLabel heroeDescripcion;
    private javax.swing.JLabel infomacionCombate;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JLabel magiaHeroe;
    private javax.swing.JLabel magiaMonstruo;
    private javax.swing.JLabel menteHeroe;
    private javax.swing.JLabel menteMonstruo;
    private runebound.ui.combate.RBCombatePanel rBCombatePanel1;
    private runebound.ui.combate.RBFinCombatePanel rBFinCombatePanel1;
    private runebound.ui.combate.RBAntesCombateTestPanel rBTestAntesCombatePanel1;
    private javax.swing.JLabel tituloHeroe;
    private javax.swing.JLabel tituloMonstruo;
    // End of variables declaration//GEN-END:variables

    /**
     * Arranca el combate
     */
    public void iniciarCombate() {
        this.rBCombatePanel1.showDuranteCombate();
    }

    public RBCombatePanel getrBCombatePanel() {
        return rBCombatePanel1;
    }

    public void nuevaRondaCombate(){
        this.getrBCombatePanel().nuevaRondaCombate();
    }
    
    public void hitHeroe(int v){
        this.heridasFlotantesHeroe.setText("-"+v);
    }
    public void hitMonstruo(int v){
        this.heridasFlotanteMonstruo.setText("-"+v);
    }
    
    public void agotarHeroe(int v){
        this.agotamientoFlotanteHeroe.setText("-"+v);
    }
    public void informar(String datos){
        this.infomacionCombate.setText(datos);
    }

    public void finCombate() {
        this.rBCombatePanel1.showFinCombate();
    }
}
